<template>
  <iframe
    id="iframename"
    :src="pageUrl"
    width="100%"
    :height="tableHeight"
    frameborder="0"
    scrolling="auto"
    name="iframename"
  />

</template>

<script>
export default {
  name: 'nestingExternalPage',
  data() {
    return {
      tableHeight: null,
      pageUrl: ''
    }
  },
  created() {
    this.getList()
  },
  mounted() {
    this.getTbHeight()
  },
  beforeMount() {
    window.addEventListener('resize', this.getTbHeight)
  },
  methods: {
    // 获取table高度的方法
    getTbHeight() {
      this.tableHeight = window.innerHeight - 70
    },
    getList() {
      const urls = this.$route.meta.pageUrl
      const menuParam = JSON.parse(urls) // jsonstr是json字符串
      const reg = /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/
      const ip = reg.exec(window.location.href)[0]
      this.pageUrl = window.location.protocol + '//' + ip + menuParam.pageUrl +
                      '&agencyCode=' + this.$store.getters.userInfo.agencyCode +
                      '&province=' + this.$store.getters.userInfo.province+
                      '&userguid='+this.$store.getters.userInfo.userguid+
                      '&year='+this.$store.getters.userInfo.year+
                      '&roleguid='+this.$route.meta.roleguid
    }
  }
}
</script>

<style scoped lang="scss">
</style>
